package com.kitty.game.fight.bean;

import com.kitty.game.fight.ai.NormalSkillChooser;
import com.kitty.game.fight.ai.SkillChooser;
import com.kitty.game.fight.message.vo.FightMember;
import com.kitty.game.mirror.model.RoleMirror;
import com.kitty.game.fight.bean.FightObject;

public class RoleMirrorFightObject extends FightObject {
    private RoleMirror roleMirror;

    private SkillChooser skillChooser = new NormalSkillChooser();

    public RoleMirrorFightObject(RoleMirror roleMirror, double propRate, int pos, int id) {
        this.roleMirror = roleMirror;

        setPos(pos);
        setName(roleMirror.getName());
        setLevel(roleMirror.getLevel());
        setId(id);
        setDefense((int) (roleMirror.getDefense() * propRate));
        setSpeed((short) (roleMirror.getSpeed() * propRate));
        setMagPower((int) (roleMirror.getMagPower() * propRate));
        setPhyPower((int) (roleMirror.getPhyPower() * propRate));
        setMaxLife((int) (roleMirror.getMaxLife() * propRate));
        setMaxMana((int) (roleMirror.getMaxMana() * propRate));
        setCurrLife((int) (roleMirror.getMaxLife() * propRate));
        setIcon(roleMirror.getIcon());
        setPolar(roleMirror.getPolar());
        setSuitIcon(roleMirror.getSuitIcon());
        setSkillIds(roleMirror.getSkillIds());
        setWeaponId(roleMirror.getWeaponIcon());
        skillChooser.init(skillIds);
    }

    public SkillChooser getSkillChooser() {
        return skillChooser;
    }

    @Override
    public int getPhyHurt(FightObject target, boolean isPenetrate) {
        return super.getPhyHurt(target, isPenetrate);
    }

    @Override
    public FightMember asFightMember() {
        FightMember fightMember = new FightMember();
        fightMember.setId(getId());
        fightMember.setSuit_icon(roleMirror.getSuitIcon());
        fightMember.setSuit_light_effect(roleMirror.getSuitLightEffect());
        fightMember.setWeapon_icon(roleMirror.getWeaponIcon());
        fightMember.setPosition((short) getPos());
        fightMember.setIcon((short) roleMirror.getIcon());
        fightMember.setList(asFieldValues());

        return fightMember;
    }

    @Override
    public int getTao() {
        return roleMirror.getTao();
    }

    @Override
    public String toString() {
        return "RoleMirrorFightObject{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", targetId="+targetId+
                '}';
    }
}
